import Axios, { AxiosRequestConfig } from 'axios';

const client = Axios.create({
    baseURL: 'http://localhost:8080'
});

export async function request(url: string, config?: AxiosRequestConfig) {
  const response = await client.request({ url, ...config });
  const result = response.data;
  // 你的业务判断逻辑
  return result;
}

export async function GET(url: string, params={}) {
  const response = await client({ url, method:'get',params:params });
  const result = response.data;
  // 你的业务判断逻辑
  return result;
}
export async function POST(url: string, data={}) {
  const response = await client({ url, method:'post',data:data });
  const result = response.data;
  // 你的业务判断逻辑
  return result;
}


export default client;
